import tushare as ts
data = ts.get_k_data("002839",start="2018-08",ktype="D")

shop = 100000
price = 6.00
step = 0.15
max_s = {4.95:0,5.1:0,5.25:0,5.4:0,5.55:0,5.7:0,5.85:0,6:20000,6.15:20000,6.3:20000,6.45:20000,6.6:20000,6.75:20000}
sell_count = 0
buy_count = 0
count = 0
for i in data:
    print(i)
for i in data.values:
    high = i[3]
    low = i[4]
    for j in max_s:
        outprice = round(j + step,2)
        if j >= low and max_s[j] == 0:
            print(high,low)
            print('买入%s'%j,i[0])
            buy_count += 1
            max_s[j] += 20000
            continue
        if high >= outprice  and max_s[j] != 0:
            print('卖出%s'%outprice,i[0])
            sell_count += 1
            max_s[j] = 0
    if high>6.6 :
        count += 1
print(count)
print(len(data.values))
print(buy_count,sell_count)
print(max_s)

